package operations;

import computer.Address;
import computer.Memory;
import computer.Operand;
import computer.ProgramCounter;
import computer.Word;

public abstract class BinExpr implements Operation {
	protected Operand o1, o2;
	protected Address n;
		
	public BinExpr(Operand o1, Operand o2, Address n) {
		this.o1 = o1;
		this.o2 = o2;
		this.n = n;
	}
	
	protected abstract void op(Word w1, Word w2, Word w3);
	public void execute(Memory memory, ProgramCounter programCounter) {
		op(o1.getValue(memory), o2.getValue(memory), n.getValue(memory));
		programCounter.increase();
	}
}
